<%--
  Created by IntelliJ IDEA.
  User: s1xgod
  Date: 2022/9/23
  Time: 22:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>login</title>
    <link rel="shortcut icon" href="/res/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../bgimg/css/supersized.css">
    <link rel="stylesheet" href="../css/login.css">
    <script src="../layui/layui.js"></script>
    <script src="../bgimg/js/jquery-1.8.2.min.js"></script>
    <script src="../bgimg/js/supersized.3.2.7.min.js"></script>
    <script src="../bgimg/js/supersized-init.js"></script>


</head>
<body>
<div class="主体">
    <div id="登录文字标题">登录</div>
    <a id="立即注册">立即注册></a>
    <form class="layui-form layui-form-pane " action="/user/login" method="post">

        <br>
        <div style="margin-left: 100px">
            <div class="layui-form-item">
                <label class="layui-form-label">登录名</label>
                <div class="layui-input-inline">
                    <input type="text" name="loginname" required lay-verify="required" placeholder="请输入登录名"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="password" required lay-verify="required" placeholder="请输入密码"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">验证码</label>

                <div class="layui-input-inline" style="width: 100px">
                    <input type="text" name="code" required lay-verify="required" placeholder="请输入验证码"
                           autocomplete="off" class="layui-input">
                </div>
                <img id='codeImg' src="/common/code?type=1">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>
        <br>
        <div class="layui-form-item submit-btn">
            <div class="layui-input-inline">
                <button class="layui-btn" lay-submit lay-filter="formDemo" id="submit2">登录</button>
                <span style="margin-left: 20px;margin-right: 20px"></span>
                <button type="reset" class="layui-btn  layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
</body>
<script>
    // 表单
    layui.use(['form', 'layer'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var layer = layui.layer;
        // 每次进来登录页面都清除user
        ${sessionScope.remove("user")}
        // 输出登录提示，来自session
        if ("${tips}" != "") {
            layer.msg("${tips}")
            ${sessionScope.remove("tips")}
        }

        // 验证码点击刷新
        $("#codeImg").click(function () {
            $("#codeImg").attr("src", "/common/code/?type=1&time=" + new Date().getTime());
        })

        // 提交登录表单
        form.on('submit(formDemo)', function (data) {
            return true;
        });

        // 点击 立即注册 后弹出注册窗口
        $('#立即注册').on('click', function () {
            //登录弹窗
            layer.open({
                type: 2, // 嵌套iframe
                title: false, //不显示标题栏
                closeBtn: true,
                area: ['520px', '420px'],
                id: 'LAY_layuipro', //设定一个id，防止重复弹出
                content: 'register.jsp',
            });
        });
    });
</script>


</html>
